package de.velvettear.dimmdrivehelper.gui;

import javax.swing.JFrame;

import java.awt.GridBagLayout;

import javax.swing.JLabel;

import java.awt.GridBagConstraints;

import javax.swing.JPanel;

import java.awt.Insets;

import javax.swing.JButton;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import java.awt.Color;
import javax.swing.JSeparator;
import java.awt.Font;

public class CoordinatePicker extends JFrame {

	public CoordinatePicker() {
		getContentPane().setForeground(Color.WHITE);
		getContentPane().setBackground(Color.LIGHT_GRAY);
		setAlwaysOnTop(true);
		setTitle("DimmdriveHelper");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		GridBagLayout gridBagLayout = new GridBagLayout();
		gridBagLayout.columnWidths = new int[]{0, 0, 0};
		gridBagLayout.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0, 0};
		gridBagLayout.columnWeights = new double[]{1.0, 0.0, Double.MIN_VALUE};
		gridBagLayout.rowWeights = new double[]{1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, Double.MIN_VALUE};
		getContentPane().setLayout(gridBagLayout);
		
		JPanel panel_info = new JPanel();
		panel_info.setBackground(Color.DARK_GRAY);
		GridBagConstraints gbc_panel_info = new GridBagConstraints();
		gbc_panel_info.gridwidth = 2;
		gbc_panel_info.fill = GridBagConstraints.BOTH;
		gbc_panel_info.gridx = 0;
		gbc_panel_info.gridy = 0;
		getContentPane().add(panel_info, gbc_panel_info);
		
		JSeparator separator = new JSeparator();
		separator.setForeground(Color.DARK_GRAY);
		separator.setBackground(Color.BLACK);
		GridBagConstraints gbc_separator = new GridBagConstraints();
		gbc_separator.gridwidth = 2;
		gbc_separator.insets = new Insets(0, 0, 10, 0);
		gbc_separator.fill = GridBagConstraints.BOTH;
		gbc_separator.gridx = 0;
		gbc_separator.gridy = 1;
		getContentPane().add(separator, gbc_separator);
		
		JLabel lbl_exe = new JLabel("Dimmdrive location:");
		lbl_exe.setFont(new Font("Quartz MS", Font.BOLD, 12));
		GridBagConstraints gbc_lbl_exe = new GridBagConstraints();
		gbc_lbl_exe.anchor = GridBagConstraints.WEST;
		gbc_lbl_exe.insets = new Insets(0, 10, 10, 10);
		gbc_lbl_exe.gridx = 0;
		gbc_lbl_exe.gridy = 2;
		getContentPane().add(lbl_exe, gbc_lbl_exe);
		
		JButton btn_location = new JButton("Change");
		GridBagConstraints gbc_btn_location = new GridBagConstraints();
		gbc_btn_location.insets = new Insets(0, 0, 5, 0);
		gbc_btn_location.gridx = 1;
		gbc_btn_location.gridy = 2;
		getContentPane().add(btn_location, gbc_btn_location);
		
		JLabel lbl_positions = new JLabel("Selected positions:");
		lbl_positions.setFont(new Font("Quartz MS", Font.BOLD, 12));
		GridBagConstraints gbc_lbl_positions = new GridBagConstraints();
		gbc_lbl_positions.anchor = GridBagConstraints.WEST;
		gbc_lbl_positions.insets = new Insets(0, 10, 5, 10);
		gbc_lbl_positions.gridx = 0;
		gbc_lbl_positions.gridy = 3;
		getContentPane().add(lbl_positions, gbc_lbl_positions);
		
		JPanel panel = new JPanel();
		GridBagConstraints gbc_panel = new GridBagConstraints();
		gbc_panel.gridwidth = 2;
		gbc_panel.insets = new Insets(0, 0, 5, 5);
		gbc_panel.fill = GridBagConstraints.BOTH;
		gbc_panel.gridx = 0;
		gbc_panel.gridy = 4;
		getContentPane().add(panel, gbc_panel);
		
		JTextArea ta_positions = new JTextArea();
		ta_positions.setWrapStyleWord(true);
		ta_positions.setLineWrap(true);
		
		JScrollPane panel_positions = new JScrollPane(ta_positions);
		GridBagConstraints gbc_panel_positions = new GridBagConstraints();
		gbc_panel_positions.gridwidth = 2;
		gbc_panel_positions.insets = new Insets(0, 10, 10, 10);
		gbc_panel_positions.fill = GridBagConstraints.BOTH;
		gbc_panel_positions.gridx = 0;
		gbc_panel_positions.gridy = 5;
		getContentPane().add(panel_positions, gbc_panel_positions);
		
		JPanel panel_buttons = new JPanel();
		panel_buttons.setBackground(Color.LIGHT_GRAY);
		GridBagConstraints gbc_panel_buttons = new GridBagConstraints();
		gbc_panel_buttons.gridwidth = 2;
		gbc_panel_buttons.insets = new Insets(0, 10, 10, 10);
		gbc_panel_buttons.anchor = GridBagConstraints.SOUTH;
		gbc_panel_buttons.fill = GridBagConstraints.HORIZONTAL;
		gbc_panel_buttons.gridx = 0;
		gbc_panel_buttons.gridy = 6;
		getContentPane().add(panel_buttons, gbc_panel_buttons);
		GridBagLayout gbl_panel_buttons = new GridBagLayout();
		gbl_panel_buttons.columnWidths = new int[]{0, 0, 0};
		gbl_panel_buttons.rowHeights = new int[]{0, 0};
		gbl_panel_buttons.columnWeights = new double[]{1.0, 1.0, Double.MIN_VALUE};
		gbl_panel_buttons.rowWeights = new double[]{0.0, Double.MIN_VALUE};
		panel_buttons.setLayout(gbl_panel_buttons);
		
		JButton btn_save = new JButton("Save");
		btn_save.setFont(new Font("Quartz MS", Font.PLAIN, 12));
		GridBagConstraints gbc_btn_save = new GridBagConstraints();
		gbc_btn_save.fill = GridBagConstraints.HORIZONTAL;
		gbc_btn_save.insets = new Insets(0, 0, 0, 10);
		gbc_btn_save.gridx = 0;
		gbc_btn_save.gridy = 0;
		panel_buttons.add(btn_save, gbc_btn_save);
		
		JButton btn_close = new JButton("Close");
		btn_close.setFont(new Font("Quartz MS", Font.PLAIN, 12));
		GridBagConstraints gbc_btn_close = new GridBagConstraints();
		gbc_btn_close.fill = GridBagConstraints.BOTH;
		gbc_btn_close.gridx = 1;
		gbc_btn_close.gridy = 0;
		panel_buttons.add(btn_close, gbc_btn_close);
		
	}
	
}
